<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                template="layout/template.xhtml">
                       
<ui:define name="body">
    
    <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
    
    <h:form id="campusSearch" styleClass="edit">
    
        <rich:simpleTogglePanel label="#{messages['application.label.searchParameters']}" switchType="ajax">
        
            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">#{messages['application.campus.label.descricao']}</ui:define>
                <h:inputText id="desCampus" value="#{campusList.campus.desCampus}"/>
            </s:decorate>

        
        </rich:simpleTogglePanel>
        
        <div class="actionButtons">
            <h:commandButton id="search" value="#{messages['application.label.search']}" action="/CampusList.xhtml"/>
        </div>
        
    </h:form>
    
    <rich:panel>
        <f:facet name="header">#{messages['application.label.searchResults']}</f:facet>
    <div class="results" id="campusList">

    <h:outputText value="#{messages['application.campus.empty']}" 
               rendered="#{empty campusList.resultList}"/>
               
    <rich:dataTable id="campusList" 
                var="campus"
              value="#{campusList.resultList}" 
           rendered="#{not empty campusList.resultList}">
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="#{messages['application.campus.label.codigo']} #{campusList.order=='idtCampus asc' ? messages.down : ( campusList.order=='idtCampus desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{campusList.order=='idtCampus asc' ? 'idtCampus desc' : 'idtCampus asc'}"/>
                </s:link>
            </f:facet>
            #{campus.idtCampus}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="#{messages['application.campus.label.descricao']} #{campusList.order=='desCampus asc' ? messages.down : ( campusList.order=='desCampus desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{campusList.order=='desCampus asc' ? 'desCampus desc' : 'desCampus asc'}"/>
                </s:link>
            </f:facet>
            #{campus.desCampus}
        </h:column>
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="#{messages['application.endereco.label']} #{campusList.order=='endereco.idtCep asc' ? messages.down : ( campusList.order=='endereco.idtCep desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{campusList.order=='endereco.idtCep asc' ? 'endereco.idtCep desc' : 'endereco.idtCep asc'}"/>
                </s:link>
            </f:facet>
            #{campus.endereco.desLogradouro}, #{campus.numEndereco} - #{campus.endereco.desBairro} - #{campus.endereco.desCidade}, #{campus.endereco.desUf}
        </h:column>
        <h:column>
            <f:facet name="header">#{messages['application.label.action']}</f:facet>
            <s:link view="/#{empty from ? 'Campus' : from}.xhtml" 
                   value="#{messages['application.label.select']}" 
                      id="campus">
                <f:param name="campusIdtCampus" 
                        value="#{campus.idtCampus}"/>
            </s:link>
        </h:column>
    </rich:dataTable>

    </div>
    </rich:panel>
    
    <div class="tableControl">
      
        <s:link view="/CampusList.xhtml" 
            rendered="#{campusList.previousExists}" 
               value="#{messages.left}#{messages.left} #{messages['application.label.first']}"
                  id="firstPage">
          <f:param name="firstResult" value="0"/>
        </s:link>
        
        <s:link view="/CampusList.xhtml" 
            rendered="#{campusList.previousExists}" 
               value="#{messages.left} #{messages['application.label.previous']}"
                  id="previousPage">
            <f:param name="firstResult" 
                    value="#{campusList.previousFirstResult}"/>
        </s:link>
        
        <s:link view="/CampusList.xhtml" 
            rendered="#{campusList.nextExists}" 
               value="#{messages['application.label.next']} #{messages.right}"
                  id="nextPage">
            <f:param name="firstResult" 
                    value="#{campusList.nextFirstResult}"/>
        </s:link>
        
        <s:link view="/CampusList.xhtml" 
            rendered="#{campusList.nextExists}" 
               value="#{messages['application.label.last']} #{messages.right}#{messages.right}"
                  id="lastPage">
            <f:param name="firstResult" 
                    value="#{campusList.lastFirstResult}"/>
        </s:link>
        
    </div>
    
    <s:div styleClass="actionButtons" rendered="#{empty from}">
        <s:button view="/CampusEdit.xhtml"
                    id="create" 
                 value="#{messages['application.label.create']}">
            <f:param name="campusIdtCampus"/>
        </s:button>
    </s:div>
    
</ui:define>

</ui:composition>

